package com.bd.rj.backstage.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bd.rj.common.entity.Interview;
import com.bd.rj.backstage.mapper.InterviewMapper;
import com.bd.rj.backstage.service.IInterviewService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 白世俊
 * @since 2025-01-03
 */
@Service
public class InterviewServiceImpl extends ServiceImpl<InterviewMapper, Interview> implements IInterviewService {
@Resource
InterviewMapper interviewMapper;
    @Override
    public IPage<Map> getInterviewByPageAndCondition(int pageNum, int pageSize,Long userId,String name,Integer status) {
        Page<Map> page = new Page<>(pageNum, pageSize);
        IPage<Map> interviewByPageAndConditon = interviewMapper.getInterviewByPageAndConditon(page, userId,name, status);
        return interviewByPageAndConditon;
    }

    @Override
    public void insertInterviewRecord(Map<String, Object> info) {
        interviewMapper.insertInterviewRecord(info);
    }

    @Override
    public int getInterviewCount(Long uid) {
       return interviewMapper.getInterviewCount(uid);
    }

    @Override
    public double getInterviewPercentage(Long uid) {
       return interviewMapper.getInterviewPercentage(uid);
    }

    @Override
    public List<Map<String, Object>> getInterviewTrend(Long uid) {
        return interviewMapper.getInterviewTrend(uid);
    }
}
